/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author cris
 */
class SecurityFilters {
	def filters = {
		doLogin(controller:'*' , action:'*' ){
			before = {
				if (!controllerName)
				return true
//				def allowedActions = ['show' , 'index' , 'list' , 'login' , 'validate' ]
//				def allowedActions = ['show' , 'index' , 'list' , 'login' , 'authenticate' ]
				def allowedActions = ['login' , 'authenticate' ]
				if (!session.user && !allowedActions.contains(actionName)){
					redirect(controller:'user' , action:'login' ,
						params:['cName' : controllerName, 'aName' :actionName])
					return false
				}
			}
		}
	}
}